import Vue from 'vue'
import Vuex from 'vuex'
import {getlist} from '@/api/index.js'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list:[],
    item:[],
  },
  mutations: {
    SET_LIST(state,payload){
      state.list=payload
    },
    SET_DETAIL(state,payload){
      console.log(state.list)
     state.item=state.list.list.find(v=>v.id===payload)
    
    }
  },
  actions: {
    async GET_LIST({commit}){
      const resp=await getlist()
      
      commit('SET_LIST',resp.data)
    }
  },
  modules: {
  }
})
